import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

//从cookie中获取token通过请求拦截器request设置到请求头header上   cookie在关闭浏览器时会自动销毁
export function getToken() {
  // console.log('getToken:',Cookies.get(TokenKey))
  return Cookies.get(TokenKey)
}

//将后端返回的token设置到cookie中
export function setToken(token) {
  // console.log('setToken:',token)
  return Cookies.set(TokenKey, token)
}
//退出登录时移除token
export function removeToken() {
  return Cookies.remove(TokenKey)
}
